<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://www.springframework.org/security/tags" prefix="sec"%>
<spring:url value="/js/candidato/datigenerali.js" var="jsUrl"></spring:url>
<spring:url value="/images/glyphicons_039_notes.png" var="notes"></spring:url>
<script src="${jsUrl}" type="text/javascript"></script>
<style>
	.ui-datepicker-trigger { 
		vertical-align:top;
		height:16px;
		width:16px;	
	}
	th,td{
		border:0;
	}
</style>
<div class="unit-row">
	<div class="unit-70" style="width:100%;opacity:0.7;background-color:#FFFFFF;font-weight:bold;">
		<nav class="nav-tabs unit-centered" style="width:1000px">
			<ul>
				<li><a href="${flowExecutionUrl}&_eventId=dati-generali">Dati Generali</a></li>
				<li><a href="${flowExecutionUrl}&_eventId=studi-compiuti">Studi compiuti</a></li>
				<li><a href="${flowExecutionUrl}&_eventId=lingue-conosciute">Lingue conosciute</a></li>
				<li><a href="${flowExecutionUrl}&_eventId=conoscenze-informatiche">Conoscenze informatiche</a></li>
				<li><a href="${flowExecutionUrl}&_eventId=esperienze-lavorative">Esperienze Lavorative</a></li>
				<li><a href="${flowExecutionUrl}&_eventId=domande-attitudinali">Analisi</a></li>
				<li><a href="${flowExecutionUrl}&_eventId=altre-informazioni">Altre Informazioni</a></li>
				<li><span>Documenti</span></li>
				<sec:authorize ifAllGranted="ROLE_ADMIN">
					<li><a href="${flowExecutionUrl}&_eventId=note-selezionatore">Note</a></li>
				</sec:authorize>
				<li><a href="<c:url value="j_spring_security_logout" />">Logout</a></li>
			</ul>
		</nav>
		<br/>
		<c:if test="${documentiSalvati eq true}">
			<div class="message message-success">
	    		<span class="close"></span>
	    		Dati salvati con successo
			</div>
		</c:if>
		<c:if test="${not empty requestScope['org.springframework.validation.BindingResult.documentiForm'].allErrors}">
			<div class="message message-error">
			    <span class="close"></span>
			    Sono presenti degli errori!
			    <c:forEach items="${flowRequestContext.messageContext.allMessages}" var="message">
					<c:if test="${message.source eq 'uploadDoc'}">
					      Documento non valido!Controllare le dimensioni e se il nome del file &egrave; gi&agrave; presente!
					</c:if>
				</c:forEach>
			</div>
		</c:if>
		<c:if test="${not empty requestScope['MaxUploadSizeExceededException']}">
			<div class="message message-error">
			    <span class="close"></span>
			    Sono presenti degli errori!Grandezza Eccessiva del documento 
			</div>
		</c:if>
		<c:set var="cvList" value="${documentiForm.cvs}" scope="session" />
		<c:set var="allList" value="${documentiForm.allegati}" scope="session" />
		
		<div class="unit-100 unit-centered" style="width:800px">
			<form:form id="documentiForm" method="post" action="${flowExecutionUrl}" commandName="documentiForm" cssClass="forms">				
				<fieldset>
				<legend>
					<h3 class="head-toc head-toc-start">Curriculum Vitae</h3>
				</legend>
					<table style="margin:auto;width:450px">
						<tr>
							<td style="width:200px;border:0">
								Nome
							</td>										
							<td style="width:125px;border:0">
								Data arrivo
							</td>									
							<td style="width:125px;border:0">
								Azioni
							</td>
						</tr>
						<c:forEach var="recordCV" items="${cvList}" varStatus="cv" begin="0" >
							<tr>
								<td><c:out value="${recordCV.nome}"></c:out></td>
								<td><fmt:formatDate value="${recordCV.dataRicezione}" pattern="dd/MM/yyyy" /></td>	
								<spring:url value="${flowExecutionUrl}&_eventId=visualizzaDocumento&idDocumento=${recordCV.idAlfresco}" var="alfrescoDoc"></spring:url>		
								<td>
								<a href="${alfrescoDoc}" target="blank">
									<img alt="Visualizza documento" src='${notes}' border="0"/>
								</a>
								</td>		
							</tr>
						</c:forEach>	
					</table>
				</fieldset>
			</form:form>
			<sec:authorize ifAllGranted="ROLE_ADMIN">
				<form:form id="nuoviCVs" method="post" action="${flowExecutionUrl}&tipoUpload=doc"
					commandName="documentiForm" cssClass="forms forms-columnar" enctype="multipart/form-data">
					<input type="hidden" name="_eventId" value="salvaCV"/>
					<table cellPadding="0" cellSpacing="0" style="width:100%;">					
						<tr>
							<td style="text-align:left">											
								Carica un CV : <input type="file" name="multipartFileUpload" id="multipartFileUpload" />													
							</td>
							<td style="text-align:center">	
								 <input type="submit" class="btn" value="Salva CV"> 
							</td>
						</tr>
						<tr>
							<td style="text-align:left" colSpan="2">																							
							 	<eM> I CV devono essere di dimensione massima 10MB</em>
							</td>
						</tr>
						<tr>
							
						</tr>
					</table>
				</form:form>	
			</sec:authorize>	
		</div>
		<div class="unit-100 unit-centered" style="width:800px">
			<form:form id="documentiForm" method="post" action="${flowExecutionUrl}" commandName="documentiForm" cssClass="forms">				
				<fieldset>
				<legend>
					<h3 class="head-toc head-toc-start">Allegati</h3>
				</legend>
					<table style="margin:auto;width:450px">
						<tr>
							<td style="width:200px;border:0">
								Nome
							</td>										
							<td style="width:125px;border:0">
								Data arrivo
							</td>									
							<td style="width:125px;border:0">
								Azioni
							</td>
						</tr>						
						<c:forEach var="recordAll" items="${allList}" varStatus="cv" begin="0" >
							<tr>
								<td><c:out value="${recordAll.nome}"></c:out></td>
								<td><fmt:formatDate value="${recordAll.dataRicezione}" pattern="dd/MM/yyyy" /></td>	
								<td>
								<spring:url value="${flowExecutionUrl}&_eventId=visualizzaDocumento&idDocumento=${recordAll.idAlfresco}" var="alfrescoAll"></spring:url>		
								<a href="${alfrescoAll}" target="blank">
									<img alt="Visualizza documento" src='${notes}' border="0"/>
								</a>
								</td>		
							</tr>
						</c:forEach>								
					</table>
				</fieldset>
			</form:form>
			
			<form:form id="nuoviAllegati" method="post" action="${flowExecutionUrl}&tipoUpload=doc"
				commandName="documentiForm" cssClass="forms forms-columnar" enctype="multipart/form-data">
				<input type="hidden" name="_eventId" value="salvaAll" >
				
				<table cellPadding="0" cellSpacing="0" style="width:100%;">					
					<tr>
						<td style="text-align:left">											
							Carica un allegato : <input type="file" name="multipartFileUpload2" id="multipartFileUpload2" />													
						</td>
						<td style="text-align:center">	
							 <input type="submit" class="btn" value="Salva Allegato"> 
						</td>
					</tr>
					<tr>
						<td style="text-align:left" colSpan="2">																							
						 	<em>Gli allegati devono essere di dimensione massima 10MB</em>
						</td>
					</tr>
					<tr>
						
					</tr>
				</table>
			</form:form>			
		</div>
	</div>
</div>

				